%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This is part of the set of files that accompany the article:       %
%Mankiw, N. Gregory and Ricardo Reis (2007) "Sticky Information in  %
%General Equilibrium," Journal of the European Economic Association,%
%forthcoming. See the appendix of the NBER or CEPR working paper    %
%versions for a detailed explanation of the algorithms.             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Please cite if you use the programs. I do not provide tech support.%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Last revised: August 30, 2006                                      %
%Written by: Ricardo Reis                                           %
%Input: the Bayesian draws in Bayes.mat and Bayesvd.mat             %
%Output: Displays the Posterior sections of Tables 1 and 2.         %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clear; clc

disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%');
disp('     RESULTS ON ESTIMATING PERVASIVE STICKINESS     ');
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%');
disp(' ')
%%%%PART A: BAYESIAN%%%%%
disp('##########################################')
disp('########     BAYESIAN RESULTS     ########')
disp('##########################################')
disp(' ')
load Bayes.mat
kk=length(R);
disp('Number of mixed sample draws'); disp(length(MixedResults));
avg=mean(MixedResults); vc=cov(MixedResults); se=std(MixedResults);
med=median(MixedResults);
lb = prctile(MixedResults,2.5); ub = prctile(MixedResults,97.5);
disp('Bayesian mean parameters and standard errors:  ')
disp('    nu   gamma   rho_g     sigma_g   rho_nu    sigma_nu  rho_gam   sigma_gam delta     omega     lambda'); disp([avg;se]);
disp('Bayesian median parameters and 95% C.I.:'); disp([med;lb;ub]);
disp('See figure for histograms')
for i=1:kk
    subplot(kk,1,i), hist(MixedResults(:,i),50);
end

load Bayesvd.mat
disp('##### Bayesian variance decomposition ##### '); disp('Columns are shocks: m a g nu gamma');
disp('Rows are variables: inflation output growth, nominal interest rate, real wage growth, and hours');
disp(' ')
disp('At median parameter estimates'); disp(VD_med)
disp('median estimates'); disp(VD_500)
disp('2.5% estimates'); disp(VD_025)
disp('97.5% estimates'); disp(VD_975)

disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%');
disp('                 THE END                            ');
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%');